#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>


void sys_err (const char *str){
	perror(str);
	exit(1);
}

void *tfn(void *arg)
{
	// son thread
	printf("thread: pid = %d, tid = %lu\n", getpid(), pthread_self());
	return NULL;
}

int main(int argc, char *argv[]){
	// main thread
	pthread_t tid;


	printf("main: pid = %d, tid = %lu\n", getpid(), pthread_self());

	int ret = pthread_create(&tid, NULL, tfn, NULL);
	if (ret != 0){
		perror("pthread_create error");
	}


	sleep(1);  // fang zhi zhu xian cheng xian tui chu,zi xian cheng hai wei zhi xing
	
	return 0;
}
